<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    
    function Girl(n){
        this.name = n;
    }

    function Boy(girl){
        this.name = "张三"
        this.girl = girl;
        this.send = function(msg){
            console.log(`你好，${this.girl.name}，这是我送你的${msg}`);
        }
    }

    function porxyLitterBrother(girl){
        this.messages = [];
        this.girl = girl;
        this.send = function(msg){
            // console.log(msg);
            // msg = "一束花";
            const b = new Boy(this.girl);
            // 拦截并记录数据内容
            this.messages.push({
                收件人:this.girl.name,
                寄件人:b.name,
                time:Date.now(),
                msg:msg
            })
            b.send(msg)
        }
    }

    const g = new Girl("翠花");

    const p = new porxyLitterBrother(g);
    p.send("一封信");



</script>
</html>